package com.ddwl.wallet.dao;

import com.ddwl.common.constant.BaseEnum;
import com.ddwl.common.dao.TkDao;
import com.ddwl.wallet.dao.mapper.SysOrderRefundMapper;
import com.ddwl.wallet.dao.model.SysOrderRefund;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.entity.Example;

import java.util.List;
@Repository
public class SysOrderRefundDao extends TkDao<SysOrderRefundMapper, SysOrderRefund> {


    public SysOrderRefund selectOrderRefund(String refundId){
        SysOrderRefund refund = new SysOrderRefund();
        refund.setRefundId(refundId);
        return selectOne(refund);
    }

    /**
     * 查询订单售后中的订单
     * @param orderId
     * @return
     */
    public List<SysOrderRefund> queryOrderRefundOngoing(String orderId){
        Example example = getExample();
        example.and().andEqualTo("orderId",orderId)
        .andLessThan("status", BaseEnum.ApplyEnum.SUCCEED.getCode());
        return baseMapper.selectByExample(example);
    }
}